<?php
/**
 * Created by PhpStorm.
 * User: yandian
 * Date: 2017/4/21
 * Time: 20:54
 */

namespace app\weixin\controller;


use app\common\controller\LiteBase;

class Article extends LiteBase
{
    private function getData()
    {
        return  \app\common\model\Article::instance()
            ->gotoPage()
            ->order('sort desc,id desc')->select();
    }

    public function index()
    {
        $this->assign('m',$this->getData());
        return $this->fetch();
    }

    public function jsonList()
    {
        return $this->jsonSuccess($this->getData());
    }

    public function detail()
    {
        $id = I('get.id',0,'intval');
        if($id){
            $this->assign('m',\app\common\model\Article::instance()->where(['id'=>$id])->find());
            return $this->fetch();
        }
    }
}